package 力扣._00周赛._119双周赛.问题2;

class Solution {
    public int removeAlmostEqualCharacters(String word) {
        int sum = 0;
        char[] chars = word.toCharArray();
        for (int i = 1; i < chars.length; i++) {
            if (chars[i] == chars[i-1] ||
                    Math.abs(chars[i] - chars[i-1]) == 1) {
                chars[i] = ' ';
                sum++;
            }
        }
        return sum;
    }
}